// algowala.cc
//
// by jag bot
//

#include <iostream>
#include <iomanip>
#include <list>
#include <iterator>
#include <fstream>
#include <string>

using namespace std;

#include "chrono.h"

int main (int argc, char* argv[]) {
  
  string filename;
  
  if (argc < 2) {
    filename = "ticks";
  } else filename = argv[1];
  
  list<double> times;

  chrono clk;
  clk.reset ();
  double t0 = clk.secs, t1 = t0;
  cout << "generating ticks for 1 second, please standby..." << endl;
  do {
    clk.tick ();
    t1 = clk.secs;
    times.push_back (clk.secs);
  } while ( (t1 - t0) < 1);
  cout << "number of ticks/sec = " << times.size () << endl;
  cout << "saved ticks in file: " << filename << endl;
  
  cout << setprecision (16);
  
  ofstream out (filename.c_str(), ios::out);
  copy (times.begin (), times.end (), ostream_iterator<double> (out, "\n"));
  
  return 0;

}
